newbieal
asked on
display new page after image is loaded
I've followed this example from Tech Republic. However, I need to know how to assign a more complicated anchor tag to the document.location.href object.
Instead of index2.html, as shown in the example below, I have the following anchor tag:
<a href='<%=formattedURL.toSt ring()%>' target='_blank'><img align="center" border="0" src="<render:getSkinPath imageName="button.gif"/>"/ ></a>  ;
How do I assign all of this to the document object?
Instead of index2.html, as shown in the example below, I have the following anchor tag:
<a href='<%=formattedURL.toSt
How do I assign all of this to the document object?
<html>
<head>
<script language="JavaScript">
// create an image object
objImage = new Image();
// set what happens once the image has loaded objImage.onLoad=imagesLoaded();
// preload the image file
objImage.src='images/image1n.gif';
// function invoked on image load
function imagesLoaded()
{
document.location.href='index2.html';
}
</script>
</head>
ASKER
Looks good, but when I implement this code, instead of opening up a new window with it pointing to myURL, it just opens up a new window with the previous screen. I'm thinking it's the href="#" part.
shouldn't it be href="myURL"?
shouldn't it be href="myURL"?
document.location.href is a control for the current window you're in. Also, if you placed "myURL" in the href="#", that defeats the purpose of assigning the javascript funtion with the url. You could also try this:
function imagesLoaded()
{
var myURL = '<%=formattedURL.toString( )%>';
window.open='myURL';
}
<a href="#" onclick="imagesLoaded();re turn false;">><img align="center" border="0" src="<render:getSkinPath imageName="button.gif"/>"/ ></a>
function imagesLoaded()
{
var myURL = '<%=formattedURL.toString(
window.open='myURL';
}
<a href="#" onclick="imagesLoaded();re
ASKER
i would like to open a new window though. How do i do this?
What i posted above opens a new window.
To open a new window you need to use ...
function imagesLoaded() {
var myUrl = '<%=formattedURL.toString( )%>';
window.open(myUrl, 'newWindow');
}
Window.open doesn't use an equal sign. Let me know if there is a question.
bol
function imagesLoaded() {
var myUrl = '<%=formattedURL.toString(
window.open(myUrl, 'newWindow');
}
Window.open doesn't use an equal sign. Let me know if there is a question.
bol
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oops sorry, pasted the wrong one:
function imagesLoaded()
{
var myURL = '<%=formattedURL.toString( )%>';
window.open(myURL)';
}
<a href="#" onclick="imagesLoaded();re turn false;">><img align="center" border="0" src="<render:getSkinPath imageName="button.gif"/>"/ ></a>
function imagesLoaded()
{
var myURL = '<%=formattedURL.toString(
window.open(myURL)';
}
<a href="#" onclick="imagesLoaded();re
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
worked, thanks much!
Try this in your JavaScript function:
function imagesLoaded()
{
var myURL = '<%=formattedURL.toString(
document.location.href='my
}
and you href tag would look something like this:
<a href="#" onClick="javascript:images
hope this helps.