Jump to content
xisto Community
Sign in to follow this  
Nani Cheri

How To Put Javascript And Css In Dreamweaver

Recommended Posts

HI,

 

If anybody worked with dreamweaver, and succesfully used JS codes and CSS in their website, please reply and tell me how to, cause when I try too put Javascripts it won't work....I also tried to put an textarea with scrollbars in a table...put in design view the content won't stay in the widths and heights I typt in...can someone help?

 

 

thanks

Share this post


Link to post
Share on other sites

No the best is if you work with dreamweaver (I've experienced this) to work either with code or with WYSIWYG. Not combining the two.But if you wrote code, the best way is to test it in your webbrowser.But what wouldn't work with your css and javascript?

Share this post


Link to post
Share on other sites

Since I can't edit my previous post, I'm gonna have to post another reply.

I'm sorry for that but I wanted to preview it but I posted it :unsure: .

 

When you are using CSS, make a stylescheet (ie in notepad) and ie name it "standard.css".

 

It contains this as example:

 

.titel {  color: 898899;  font-size: 25px;  font-family: verdana;  cursor:default;  border-style:solid;  border-width:0;  vertical-align:middle;  padding-left:10;}.inhoud {  color: white;  font-size: 13px;  font-family: verdana;  cursor:default;  border-width:0;  vertical-align:middle;}.inhoud a:link { color:#ffffff; text-decoration:none; font-size: 13px; }.inhoud a:visited { color:#ffffff; text-decoration:none; font-size: 13px; }.inhoud a:active { color:#ffffff; text-decoration:none; font-size: 13px; }.inhoud a:hover { color:#ffffff; text-decoration:none; font-size: 13px; }
This is a piece of a css sheet I am making.

 

Now in the <head></head> part of your html code you put following line of code:

<link rel="stylesheet" type="text/css" href="directory/standard.css">

 

that's it. Now as example I want to add the inhoud style to a tablecell.

<html><head><title>Document title</title><link rel="stylesheet" type="text/css" href="directory/standard.css"></head><body><table><tr><td class="inhoud">Some text</td></tr></table></body></html>
now dreamweaver will automatically give you a list with possible css styles from the stylesheets you've included when you type class=", then you can choose your style with the up and down arrow keys and confirm with a tab-key push. Dreamweaver will automatically insert the chosen style and add the final quote (").

 

For you're javascript, I don't know what code you want to use but here's a little example:

 

<html><head><title>document title</title><script language="javascript" type="text/javascript">function showexample(){alert("This is an example of the use of a JavaScript code");}</script></head><body><input type="button" value="Click me for the example" onClick="javascript:showexample();"></body></html>

Hope this helps a bit but if you have other questions, ask :P

Share this post


Link to post
Share on other sites

.inhoud a:link { color:#ffffff; text-decoration:none; font-size: 13px; }.inhoud a:visited { color:#ffffff; text-decoration:none; font-size: 13px; }.inhoud a:active { color:#ffffff; text-decoration:none; font-size: 13px; }.inhoud a:hover { color:#ffffff; text-decoration:none; font-size: 13px; }
Can I just point out that the reason why Cascading Style Sheets are called that is cos the styles cascade down from one element to another.If you set a style on your <a> tag, all states of the tag will pick up that style. You only need to add additional rules for when you want something different to occur.
So taking the above example, you would be better off doing:

.inhoud a { color:#ffffff; text-decoration:none; font-size: 13px; }.inhoud a:visited { color: red; }.inhoud a:active { color:green; }.inhoud a:hover { color:black; text-decoration:underline; }
Also, you've specified a font in your .titel and .inhoud classes, whereas if you do this:

body { font-family: verdana; }
it will flow down through every element in your document and you don't have to keep repeating it.

Share this post


Link to post
Share on other sites

Can I just point out that the reason why Cascading Style Sheets are called that is cos the styles cascade down from one element to another.

If you set a style on your <a> tag, all states of the tag will pick up that style. You only need to add additional rules for when you want something different to occur.

So taking the above example, you would be better off doing:

 

.inhoud a { color:#ffffff; text-decoration:none; font-size: 13px; }.inhoud a:visited { color: red; }.inhoud a:active { color:green; }.inhoud a:hover { color:black; text-decoration:underline; }
Also, you've specified a font in your .titel and .inhoud classes, whereas if you do this:

 

body { font-family: verdana; }
it will flow down through every element in your document and you don't have to keep repeating it.

159555[/snapback]


Yes, in some cases you're right. But maybe in this case this isn't really a good example. I think yours is better B). But this is a piece from a site I am making and the style MAY NOT occur on every element since I work with tables and php that generates different tables, and the style depends on the cellcontent.

 

But you said something I didn't knew. However I work with dreamweaver and the fill-list automatically appears when you type < I hadn't noticed the class attribute for links. So I learned something new as well :P.

Share this post


Link to post
Share on other sites

in dreamweaver, you can add javascript and style sheet as following:in the windows menu, open the style sheet window, then in the bottom of the small window, you can see that have some icon, hover over the mouse on each icon, a tooltip will show up that tell you what they are function. let say add new style, a window will be promped you whether to to select make a internal or external one.about javascript, you can pop-down the menu called insert(that may be the menu on left or right, but no so far, coz i'am using it in work, not home, :P ), then, find an item call insert javascipt. also, a small window open that asked you to write vbscript or javsscript ( and version you use ). when you have finished it. a small achor icon will show up in you document. just like a layer.- hope this help

Share this post


Link to post
Share on other sites

in dreamweaver, you can add javascript and style sheet as following:

 

in the windows menu, open the style sheet window, then in the bottom of the small window, you can see that have some icon, hover over the mouse on each icon, a tooltip will show up that tell you what they are function. let say add new style, a window will be promped you whether to to select make a internal or external one.

 

about javascript, you can pop-down the menu called insert(that may be the menu on left or right, but no so far, coz i'am using it in work, not home, :P ), then, find an item call insert javascipt. also, a small window open that asked you to write vbscript or javsscript ( and version you use ). when you have finished it. a small achor icon will show up in you document. just like a layer.

 

- hope this help

201730[/snapback]


thanks thats really short and clear explained...Ill try that 2!! thanks everyone

Share this post


Link to post
Share on other sites

sometimes when you're using dreamweaver (DW), some css styles aren't previewed (on DW window). for example, if you write as a CSS code:a:link {color: cornflowerblue; text-decoration: none}instead, you should use the following text to do the same and be able to preview it:a {color: cornflowerblue; text-decoration: none}plus, any JavaScript code can't be preview on the DW window.

Share this post


Link to post
Share on other sites

What you see in design view often is not what it will look like in-browser, you need to test it in-browser to see the end result. But Dreamweaver 8 is getting better that this, and it even shows images that are linved via a url :)

Share this post


Link to post
Share on other sites

What you see in design view often is not what it will look like in-browser, you need to test it in-browser to see the end result. But Dreamweaver 8 is getting better that this, and it even shows images that are linved via a url :angry:


really? yeah I actually find it very bad you can't see javascript result in DW, you have to test it constantly. I have this problem to with a calendar i inserted with javacript in a table. But only in browser I saw that my table stretch with other the calendar, so some of my content in another column strech with it. And in DW itself it looks good. goes the calendar isnt visible yet. don't know what to do about that. But I think theres no solution for that right?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.