| | |
Works in IE not Firefox
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Nov 2008
Posts: 6
Reputation:
Solved Threads: 0
I written a code to create a image viewer using javascript. But the script only works in IE but not in firefox. Please help.
The code is below......
The code is below......
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<script type="text/javascript"> function changeImage(filename) { mainimage.src = filename; } </script> <center> <img src="images/bg.jpg" name="mainimage" width="419" height="282"> <marquee width="90%" scrollamount="5" onmouseover="this.stop();" onmouseout="this.start();"> <?php include 'database_conn.php'; $tbl_name="property"; $sql = "SELECT * FROM $tbl_name WHERE worth='1' && activation='1'"; $query = mysql_query($sql) or die(mysql_error()); echo "<table><tr>"; while ($row =mysql_fetch_array($query)) { $title = $row['title']; $area = $row['area']; $propertyid = $row['propertyid']; $image1 = $row['image1']; $contact = $row['contact']; $price = $row['price']; if (empty($image1)) { $image1 = "uploaded_files/no photo.jpg"; ?><a href="javascript:changeImage('<?php echo $image1;?>')"><td><center><?php echo "$title";?></center><img src="<?php echo $image1;?>" width='90' height='80'><br><center><a href='detail.php?propertyid=<?php echo "$propertyid'"; ?>'>Details</a></center></td><?php } else { ?><a href="javascript:changeImage('<?php echo $image1;?>')"><td><center><?php echo "$title";?></center><img src="<?php echo $image1;?>" width='90' height='80'><br><center><a href='detail.php?propertyid=<?php echo "$propertyid'"; ?>'>Details</a></center></td><?php } } echo "</tr></table>"; mysql_close($conn); ?></marquee></center> Reply With Quote
•
•
Join Date: Sep 2009
Posts: 2
Reputation:
Solved Threads: 1
•
•
•
•
I written a code to create a image viewer using javascript. But the script only works in IE but not in firefox. Please help.
The code is below......
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<script type="text/javascript"> function changeImage(filename) { mainimage.src = filename; } </script> <center> <img src="images/bg.jpg" name="mainimage" width="419" height="282"> <marquee width="90%" scrollamount="5" onmouseover="this.stop();" onmouseout="this.start();">
function changeImage(filename)
{
document.getElementById("mainimage").src=filename;
}
•
•
•
•
I written a code to create a image viewer using javascript. But the script only works in IE but not in firefox. Please help.
The code is below......
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<script type="text/javascript"> function changeImage(filename) { mainimage.src = filename; } </script> <center> <img src="images/bg.jpg" name="mainimage" width="419" height="282"> <marquee width="90%" scrollamount="5" onmouseover="this.stop();" onmouseout="this.start();"> <?php include 'database_conn.php'; $tbl_name="property"; $sql = "SELECT * FROM $tbl_name WHERE worth='1' && activation='1'"; $query = mysql_query($sql) or die(mysql_error()); echo "<table><tr>"; while ($row =mysql_fetch_array($query)) { $title = $row['title']; $area = $row['area']; $propertyid = $row['propertyid']; $image1 = $row['image1']; $contact = $row['contact']; $price = $row['price']; if (empty($image1)) { $image1 = "uploaded_files/no photo.jpg"; ?><a href="javascript:changeImage('<?php echo $image1;?>')"><td><center><?php echo "$title";?></center><img src="<?php echo $image1;?>" width='90' height='80'><br><center><a href='detail.php?propertyid=<?php echo "$propertyid'"; ?>'>Details</a></center></td><?php } else { ?><a href="javascript:changeImage('<?php echo $image1;?>')"><td><center><?php echo "$title";?></center><img src="<?php echo $image1;?>" width='90' height='80'><br><center><a href='detail.php?propertyid=<?php echo "$propertyid'"; ?>'>Details</a></center></td><?php } } echo "</tr></table>"; mysql_close($conn); ?></marquee></center> Reply With Quote
They'll need externally patched built-in functions attached to Document Object, to become aware of them and be able to reach them. But not without script action. They could trigger this function internally after onload event would fire, but that would impact their render engine, rise more memory issues present and would fail to update DOM changes on runtime because of internal ondomchange event imperfections that would occasionally rise errors like this or that element is "Undefined" even though present.and defined.
Therefore you will be needing a function call "document.getelementById() every time you have to reference some object to manipulate its properties. It's good to keep this in mind an not forget make that call whenever you are referencing to your aimed elements.
•
•
Join Date: Nov 2008
Posts: 6
Reputation:
Solved Threads: 0
I tried using
It's not working in both IE and firefox
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
function changeImage(filename) { document.getElementById("mainimage").src=filename; }
It's not working in both IE and firefox
•
•
•
•
I tried using
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
function changeImage(filename) { document.getElementById("mainimage").src=filename; }
It's not working in both IE and firefox
"
DaniWeb Community > Web Development > JavaScript / DHTML / AJAX
JavaScript / DHTML / AJAX RSS JavaScript / DHTML / AJAX RSS
Works in IE not Firefox
:'p
Last edited by Troy III; Sep 21st, 2009 at 1:24 pm.
<img src="images/bg.jpg" name="mainimage" width="419" height="282"> Should be html Syntax (Toggle Plain Text)
<img src="images/bg.jpg" id="mainimage" width="419" height="282">
javascript Syntax (Toggle Plain Text)
function changeImage(filename) { document.getElementById("mainimage").src=filename; }
<element name= . is not formally deprecated, it just does not work Last edited by almostbob; Sep 21st, 2009 at 1:37 pm.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
Join Date: Nov 2008
Posts: 6
Reputation:
Solved Threads: 0
Aha, Thanks currently it works in IE again but still facing abit of problem in the Firefox , i'm guessing that there is some errors due to this part of codes.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<a href="javascript:changeImage('<?php echo $image1;?>')"><td><center><?php echo "$title";?></center><img src="<?php echo $image1;?>" width='90' height='80'><br><center>
•
•
Join Date: Nov 2008
Posts: 6
Reputation:
Solved Threads: 0
I made a few changes
And finally it works
But mainly all thanks to the document.getElementById.
SOLVED
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
?><td><center><a href="javascript:changeImage('<?php echo $image1;?>')"><?php echo "$title";?><br><img src="<?php echo $image1;?>" width='90' height='80'><br><a href='detail.php?propertyid=<?php echo "$propertyid'"; ?>'>Details</a></center></td><?php
And finally it works
But mainly all thanks to the document.getElementById.
SOLVED
extra suggestion is to get a code highlighting editor like notepad++ notepad2, or if the IDE you are using supports code highlighting turn it on
wrong code, missing quotes, too many quotes, unclosed pairs, out of sequence pairs will be highlighted
line 34 <a><td></a></td> shows as left in my editor will break
edit didn need the code to post too?
wrong code, missing quotes, too many quotes, unclosed pairs, out of sequence pairs will be highlighted
line 34 <a><td></a></td> shows as left in my editor will break
edit didn need the code to post too?
Last edited by almostbob; Sep 21st, 2009 at 2:03 pm.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
![]() |
Similar Threads
- minimal AJAX script works in Firefox, but not in IE, Opera, or Chrome (JavaScript / DHTML / AJAX)
- Image Map Works in IE but not in Firefox (HTML and CSS)
- Script works in IE, but not in Firefox (JavaScript / DHTML / AJAX)
- Works in Firefox, not in IE7 (PHP)
- Website not working in IE but works in Firefox (Web Browsers)
- Works in IE but not in Firefox? (JavaScript / DHTML / AJAX)
- Form has no properties in FireFox... Works in IE (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: AJAX vs Flash
- Next Thread: Need a Javascript code for changing mouse pointer
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxexample ajaxjspservlets api autoplay blackjack browser bug captchaformproblem checkbox child class close cookies createrange() cursor date debugger dependent developer disablefirebug dom dropdown editor element embed engine events explorer ext file flash form forms game gears getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images internet java javascript javascripthelp2020 jquery jsf jsfile jump libcurl maps math matrixcaptcha media mp3 mysql object onerror onmouseoutdivproblem onreadystatechange parent passing paypal pdf php player position post programming progressbar rated runtime safari scriptlets scroll search security session shopping size software solutions star stars stretch synchronous tweet unicode web webkit webservice window wysiwyg \n






