Webmaster Forum


Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 11-19-2006, 01:05 PM
Junior Member
 
Join Date: 10-06-06
Posts: 19
iTrader: 0 / 0%
Javascript and images

Heres the deal : I need to write a javascript code that essentially flips a given image over the x-axis. I keep getting an error "error in parsing value for property 'top'. I want to take a picture that is on the screen, make a new div like 100 pixels below it, and then output the upside down picture.

Here's the code:

Code:
<html> <head> <style type="text/css"> div {overflow:hidden; position:absolute;} span {position:absolute;} </style> <script type = "text/javascript"> </script> </head> <body> <span style="left:0px; top:150px; width:750px; height:71px"> <img src="project2.jpg"/> </span> <script type = "text/javascript"><!-- for(var k=71;k>0;k--) { document.write("<div style='left:0; top: (300 + "+k+"); width:750; height:1'>");//create the div block document.write("<span style='left:0; top: -("+k+" - 71);'>");//create the span block inside the div block document.write("<img title='newpic' src='project2.jpg'/>");//put the image in the span document.write("</span></div>");//close everything } //--> </script> </body> </html>
 
Reply With Quote
  #2 (permalink)  
Old 11-20-2006, 11:06 AM
Izzmo's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 11-01-03
Location: Kansas
Posts: 1,356
iTrader: 1 / 100%
Lol.. I didn't even know you could do this javascript.

I just learned something new today !!
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
 
Reply With Quote
  #3 (permalink)  
Old 11-20-2006, 03:48 PM
StupidScript's Avatar
Senior Member
Latest Blog:
None

 
Join Date: 09-22-06
Location: Los Angeles
Posts: 663
iTrader: 0 / 0%
How about performing the calculation before attempting to use it?
Code:
for(var k=71;k>0;k--) { t1=300+k; t2=k-71; document.write("<div style='left:0; top: "+t1+"px; width:750; height:1'>");//create the div block document.write("<span style='left:0; top: -"+t2+"px;'>");//create the span block inside the div block document.write("<img title='newpic' src='project2.jpg'/>");//put the image in the span document.write("</span></div>");//close everything }
__________________
James Butler

Where would we be without rhetorical questions?
 
Reply With Quote
  #4 (permalink)  
Old 11-20-2006, 05:28 PM
Junior Member
 
Join Date: 10-06-06
Posts: 19
iTrader: 0 / 0%
it creates a picture that is the same size as the original, but I don't think that it is flipping it. It essentially just creates 71 of the first line in the image; in this case, just a lot of blue, not blue with text.
 
Reply With Quote
  #5 (permalink)  
Old 11-20-2006, 05:32 PM
Junior Member
 
Join Date: 10-06-06
Posts: 19
iTrader: 0 / 0%
nevermind! Thank you very much for this useful insight!!!!
 
Reply With Quote
  #6 (permalink)  
Old 11-20-2006, 05:32 PM
Junior Member
 
Join Date: 10-06-06
Posts: 19
iTrader: 0 / 0%
oh just so you know, i did what you suggested, but also took out the minus sign around t2. hehe.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What type of images and royalty free images do developers and webmasters need? EZRoyaltyFree Web Design Lobby 0 02-26-2008 08:11 AM
How often does google upload images to Google Images? tessatoons Google Forum 6 10-05-2006 05:46 AM
JavaScript, color images, thingy. kwvarga Coding Forum 3 11-27-2005 01:45 PM
Count-up from a particular year + Javascript within Javascript? Help! Azam.biz Coding Forum 3 06-06-2005 06:47 AM
Can I do this with JavaScript? blelisa Coding Forum 2 09-27-2004 02:01 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 12:04 PM.
Powered by vBulletin
Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.