Click to See Complete Forum and Search --> : script within writeln Help!


aengblom
12-03-2002, 04:52 PM
I'm having some trouble with my web page ( http://www.aengblom.com )


I have a javascript function that a friend helped me with, but who is
now unavailable. I wanted to make some alterations as an afterthought,
but I'm only at the beginning level and I can't seem to figure out how
to alter it to my exact specifications.

I would appreciate any help!

Here's my script:

<script type="text/javascript" language="javascript">

for( var i in aMaininfo )
{

if( aMaininfo[i][cID] == "" ) //skip the one that is
blank
continue;
document.writeln( "<p><a href='" + aMaininfo[i][cHREF]

+ "' onClick='window.open(\""
+ aMaininfo[i][cHREF] + "\");return false;'
id='" + aMaininfo[i][cID]
+ "' onMouseOver='setInfo( " + i + " );'>"
+ aMaininfo[i][cTEXT] + "</a></p>" );

}
</script>

aMaininfo, id, cHREF, cID, cText and setInfo are variables that are
defined in an earlier script that you can see at my site. (Some line
breaks added for clarity)

I want the window.open line to open a window (which it does
successfully), but set the height, width and remove all the menu's etc
except the title bar and scroll bars if needed.

For example I have tried this:

document.writeln( "<p><a href='"
+ aMaininfo[i][cHREF]
+ "' onClick='window.open(\""
+ aMaininfo[i][cHREF] + "\", "
+ "name," + "width=200,height=200");return false;'
id='" + aMaininfo[i][cID]
+ "' onMouseOver='setInfo( " + i + " );'>"
+ aMaininfo[i][cTEXT] + "</a></p>" );

...and a number of other variations, but it doesn't work.

If anyone would be so kind I'd love to know WHY it would work as well.
It seems I can't figure out home many quotes, single-quotes, plus signs and backslashes and where they should go.

Thanks you for any help

-Drew

feel free to e-mail me at javascript @ aengblom . com

aengblom
12-07-2002, 04:48 PM
I'm sorry, but I couldn't get this to work. Am I stupid? ;-)


I tried pasting this in and using the string. I also tried deleting "str +=" and making it one long line. But nothing worked :(

http://www.aengblom.com/index1.5beta.html

http://www.aengblom.com/index1.51beta.html

Sorry i'm totally lost! I'd love any help

Thanks!

aengblom
12-08-2002, 03:54 PM
Thanks Dave.

It seems closer, but no success yet. IE gives me an error that my variable aMainInfo is not defined. I don't have such a problem without the new variable.

Perhaps I am using it incorrectly?

See it here:

http://www.aengblom.com/indexbeta1.4.html

I appreciate all your help

aengblom
12-09-2002, 09:00 AM
Ok. that one I can fix ;-).

That's the problem when you revise a document for the 1,000th time. Wierd things seem to pop up.

aengblom
12-09-2002, 09:26 PM
Ok so I'm know operating under the idea that the script you gave me should be in the second script (below the head) that runs the writeln. This of course, makes sense ;-).

However, still slight problems. IE and Moz tell me I have an illegal character.

it seems to be with this line

str += '"' + aMaininfo[i][cHREF] + '"';

(That's what Moz complains about. IE complains about the next line, character 37. But there is no character 37 on the next line)

Thanks to Dave and all looking at the thread.

aengblom
12-10-2002, 12:19 AM
Sorry, didn't update the link

Everything should be (well visibly broken ;-) ) now

;)

aengblom
12-10-2002, 08:53 AM
Did that, still brokenhttp://www.aengblom.com/indexbeta1.5.html

aengblom
12-11-2002, 08:44 AM
Ok That's fixed and IE does not find errors in the code any more

http://www.aengblom.com/indexbeta1.6.html


But as you point out, now "i" is undefined. I guess I'll try and study up on what changed to mean that "i" needs to be defined differently.

http://www.aengblom.com/indexbeta1.7.html

Thanks!

aengblom
12-16-2002, 10:16 PM
err bump?

Any help? Thanks. Can't seem to figure it

aengblom
12-17-2002, 03:47 PM
Hi Dave! You continue to bear the brunt of my ignorance!

Thank you!

In the second link I defined "i", but "i" actually needs to be cycled through 0-6 so that it produces the six distinct links. (In this case it's defined as 1)

(See and compare http://www.aengblom.com with http://www.aengblom.com/indexbeta1.7.html (http://www.aengblom.com/indexbeta1.7.htm)

For some reason, what worked in the original script, somehow broke when we switched to using a string