From: Bottom of an empty bottle Insane since: Aug 2004
posted 08-30-2004 14:16
I have a few reference book, but i cant seem to find what im looking for. Its also easier to ask here than troll thru a 1500 page book with type too small to read without giving myself a headache... but im rambling...
Im trying to make this :
<button onClick=" ">Close Window</button>
I know there is supposed to be something between the quotes, but I cant pull my head out of me a$$ long enough to figure it out. Im running DW MX 2004, and i cant seem to find the action there to just drop in. Its so intuitive, its been a great help with me getting up to speed, but I cant seem to get this done.
thanks.
C.
And yes, im a noob. I figured with this question it was pretty obvious, but Ill state it for the record. I have done light design for a while, and tinkered a lot, but I tend to get bored quickly. I made myself promise to really, REALLY get into DW and be somewhat proficient by the end of Sept. Wish me luck.
And I may be misunderstanding, but you will need to actually define the 'closeWindow' function.
{{edit - and yes, this is the 21st century as opposed to the middle ages. That means that there are now countless sources of information from which you can learn how to do things properly and avoid getting errors
You mentioned something about Dreamweaver...I'll take a few guesses here, using imperfect information. (I've not used dreamweaver in years, and, thankfully, I've done a good job of wiping the details from my memory.)
What doctype are you using?
If you are using XHTML and your code reads:
From: Bottom of an empty bottle Insane since: Aug 2004
posted 08-30-2004 22:16
Okay... My bad for not explaining i am a newbie (i did, but not at the front of my og post, it was at the end...)
But I guess my question is you know what... Ill copy the whole thing here...
From the last post from mobrul Im assuming i have to define the closeWimdow function somehow. And in Dreamweaver it comes up automatically with the uppercase. So unless they have it wrong in the program (possible, but not probable...) Im not sure what Im missing.
Im really thankful for all the info, and I know when its fixed Ill feel like an ass, because it will have been something so simple I should have figured it out in 5 min.
POST EDITED !!!
I found a MXP to drop in to give me the behavior I needeed. Thanks again for all the feedback below is the fixed HTML (but not the final HTML. Im still fixing the sixe and noresize, which is not written in yet.)
quote:And in Dreamweaver it comes up automatically with the uppercase. So unless they have it wrong in the program (possible, but not probable...) Im not sure what Im missing.
What you are missing is that Dreamweaver (and the like) are horribly suited as tools on which to learn the technology you are trying to learn.
That is, learning becomes MORE difficult with this sort of software, not less.
I strongly suggest you get yourself a copy of vi, notepad, or even our very own Mr. Max's HTML Beauty and learn to code on your own. It'll be slow at first, but with some helpful people around here, you'll be actually learning in no time.
So, back to the issue at hand.
Clean up your code, at least a little bit. In your button element, the onclick attribute, what you are doing is calling a function. Well, actually, right now you are calling two functions. One of them (closeWindow()) does not exist. One of them (close_window()) does exist.
Remove the one that does not exist.
Now the important thing here is not that you can manipulate Dreamweaver or copy some code I (or anyone else) posts up here. The important thing is that you understand why we (me, dreamweaver, DL, etc) put that code there in the first place.
From: Bottom of an empty bottle Insane since: Aug 2004
posted 08-31-2004 12:17
quote:Now the important thing here is not that you can manipulate Dreamweaver or copy some code I (or anyone else) posts up here. The important thing is that you understand why we (me, dreamweaver, DL, etc) put that code there in the first place.
Uh... im not trying to steal anyones stuff...I just didnt know what I was doing, and why stuff wasnt working. I figured that the reason most people put the code here is to show in HTML what is wrong and how to fix it. I never meant to plagiarize or anything like that.
the main reason i use Dreamweaver and GoLive(not so much anymore...) is they are WYSIWYG with a split code/design view. I am very visual, so for me its easier to lay it out first as I want it, then edit the code...tweak it to do what I want. I know in some ways it would be easier to learn the core language first, then go back or not use them at all, but for now, and for what I want to do, it is easier.
And now looking at the javascript function and the button line I see exactly what you are saying with the double code error.
Thanks again (and again) for the help.(I think I should make that My sig...)
I wasn't talking about stealing. If I put something up in here, I consider it open for people to take, use, twist, build with, learn from, and ultimately create something better...then bring it back here, share, and the process starts all over again.
Plagiarism was the last thing on my mind. No worries there.
I would argue that the "lay it out first...then edit [later]" philosophy of web design is:
old school
inefficient
not in line with w3c standards
counterproductive for learning
Now, if you're convinced Dreamweaver is the way to go, I'm not going to argue with you. You have every right to follow the path you wish. But, if you're interested in looking at web development in a different light, just say so. In fact, I'd strongly encourage you to do so.
That's all I was talking about.
But really, all this begs the question 'why not just use this:
code:
<button type="button" onclick="window.close()">
?'
Of course, knowing squat about javascirpt myself and not being as up with my XHTML as I should be I could possibly have that wrong, but isn't it easier than creating a whole seperate function for the one method?
I have no idea whatsoever if that validates or not.
Functionally, it would work well.
For me, it's a philosophy thing. I like to keep my JS seperate from my XHTML seperate from my CSS.
In fact, if it were me, I'd simply assign it a class = "close" with no onclick attribute.
Then, I'd have a function (called onload) which would dynamically assign to it an onclick attribute, assigning to it the appropriate function.