[WSG] Javascript help with Reg Exp required please

2008-06-02 Thread Pierre-Henri Lavigne

Good day all,

Does anyone already get the following issue ?

html
body
script type=text/javascript

var str = The Foo fooSz Fighers;
var rule = /foo\s/i;
console.log(str.match(rule)); // returns Foo

var str2 = The Foo fooSz Fighers;
var txt = foo;
var rule2 = eval('/' + txt + '\s/i');
console.log(str2.match(rule2)); // returns fooSz

/script
/body
/html

or did I miss something ?

Thanks,

Peter
---
Pierre-Henri Lavigne aka Åkeson Chihiro
Frontend Developer, Fink Member
http://my.opera.com/Akeson_Chihiro/


  Découvrez les styles qui font sensation sur Yahoo! Québec Avatars.
http://cf.avatars.yahoo.com/

***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***


R: [WSG] Javascript help with Reg Exp required please

2008-06-02 Thread Diego La Monica
Why not use the following?

 

new RegExp(txt + ‘\s’, ‘i’);

 

 

Diego La Monica

Web 2.0 - Standards - Accessibilità

mobile: +39 3337235382 - skype: diego.la.monica

web: http://diegolamonica.info - http://jastegg.it

 

  _  

Da: Pierre-Henri Lavigne [mailto:[EMAIL PROTECTED] 
Inviato: lunedì 2 giugno 2008 19.44
A: wsg@webstandardsgroup.org
Oggetto: [WSG] Javascript help with Reg Exp required please

 


Good day all,

Does anyone already get the following issue ?



html


body


script type=text/javascript





var str = The Foo fooSz Fighers;


var rule = /foo\s/i;


console.log(str.match(rule)); // returns Foo





var str2 = The Foo fooSz Fighers;


var txt = foo;


var rule2 = eval('/' + txt + '\s/i');


console.log(str2.match(rule2)); // returns fooSz





/script


/body


/html





or did I miss something ?





Thanks,





Peter

---
Pierre-Henri Lavigne aka Åkeson Chihiro
Frontend Developer, Fink Member
http://my.opera.com/Akeson_Chihiro/

 

  _  

Découvrez les styles qui font sensation sur  http://cf.avatars.yahoo.com/
Yahoo! Québec Avatars


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***


R: [WSG] Javascript help with Reg Exp required please

2008-06-02 Thread Dennis Lapcewich
Return Receipt
   
   Your   R: [WSG] Javascript help with Reg Exp required please
   document:   
   
   wasDennis Lapcewich/R6/USDAFS   
   received
   by: 
   
   at:06/02/2008 11:36:00  
   






***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



R: [WSG] Javascript help with Reg Exp required please

2008-06-02 Thread lisa . kerrigan
Return Receipt
   
   Your   R: [WSG] Javascript help with Reg Exp required please
   document:   
   
   wasLisa Kerrigan/StateDevPolicy/DSD 
   received
   by: 
   
   at:03/06/2008 09:42:03 AM   
   





**
Department of Innovation, Industry and Regional Development, 
Government of Victoria, Victoria, Australia.  

This e-mail and any attachments may contain privileged and confidential
information.   If you are not the intended recipient, you may not distribute
reproduce this e-mail or the attachments.   If you have received this message
in error, please notify us by return e-mail.

**



***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



[WSG] javascript help

2007-10-31 Thread Alexander Uribe
 
 
 
Hi there,
 
I have some questions for an assignment that I can't figure out. If anyone 
could be of assistance that would be much appreciated.
 
1)Which instruction will change the background colour of an element?
A   document.getElementById(t).backgroundColor = yellow 
B  document.getElementById(t).bgcolor = yellow 
C  document.getElementById(t).style.backgroundColor = yellow 
D  document.getElementById(t).style.color = yellow
 
2)
Which are the valid 'for' statement(s) 
A  for x = 1 to 10 
B  for(x=0; x10; x++) 
C  for(x=0, y=10; x10; x++, y--) 
D  for(x=0, x10, x++)
 
3)
Which are the INCORRECT math equations 
A  a =+ 20; 
B  a = a + 20; 
C  a = 20 / 4; 
D  a++; 
E  a != 30; 
F  a =* 4; 
G  a = 3;
 
4)
Which are the preferred methods to use when Javascript has been disabled ?
A  noscript/noscript 
B  a href=# onCick=myFunction();Show Page/a 
C  a href=page1.htmShow Page/a 
D  a href=page1.htm onCick=myFunction();Show Page/a
 
5)
An array can be initialised by 
A  var a = new Array(ab,b,c);
B  var a = [a,b,c]; 
C  var a = (a,b,c); 
D  var a = a[a,b,c];
 
6)
When you tab into a form control (i.e. a textbox) what event is executed 
A  onMouseOut 
B  onClick 
C  onBlur 
D  onFocus
 
7)
What syntax is needed to initalise a Regular Expression 
A  var re = RegExp(); 
B  var re = new RegExp(); 
C  var re = regexp; 
D  var re = new regexp();
 
8)
What does the following function dofunction 
x(y){document.getElementById(y).style.display;a = (z=='block') ? 'none' : 
'block';z.a;} 
A  hide or shows a div tag 
B  hide or shows an element 
C  hide or shows a paragraph 
D  hide or show a table
 
9)
Which cross browser (but not W3C DOM compliant instructions) can be used to 
find the Height and Width of an object on a web page A  clientWidth, 
clientHeight 
B  scrollWidth, scrollHeight 
C  scrollTop, scrollLeft 
D  offsetWidth, offsetHeight
 
10)
If Javascript has been disabled by the user then 
A  inline scripting will still work 
B  only mouse events will still work 
C  AJAX will still be useable 
D  no scripts will be executed
 
 
Cheers.
_
What are you waiting for? Join Lavalife FREE
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%26a%3D30288_t=764581033_r=email_taglines_Join_free_OCT07_m=EXT

***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***


[WSG] Javascript Help

2007-10-31 Thread Alexander Uribe
 
 
 
Hi there,
 
If anyone can help with the following questions, that would be greatly 
appreciated
 
 
 
1) Which are the preferred methods to use when Javascript has been disabled 
A noscript/noscript 
b a href=# onCick=myFunction();Show Page/a 
ca href=page1.htmShow Page/a
d a href=page1.htm onCick=myFunction();Show Page/a
 
 
 
 
2)An array can be inititialsed by?
A
var a = new Array(ab,b,c); 
B
var a = [a,b,c]; 
C
var a = (a,b,c); 
D
var a = a[a,b,c];
 
 
3)When you tab into a form control (i.e. a textbox) what event is executed 
A
onMouseOut 
B
onClick 
C
onBlur 
D
onFocus
 
uestion 22 : (DOM 1) 












  






_
Your Future Starts Here. Dream it? Then be it! Find it at www.seek.com.au
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau%2F%3Ftracking%3Dsk%3Ahet%3Ask%3Anine%3A0%3Ahot%3Atext_t=764565661_r=OCT07_endtext_Future_m=EXT

***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***


RE: [WSG] javascript help

2007-10-31 Thread Kepler Gelotte
 Hi there,

 I have some questions for an assignment that I can't figure out. If anyone
could be of assistance that would be much appreciated.
 
How many credits do we get for the correct answers? ;-)


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***

Re: [WSG] javascript help

2007-10-31 Thread Breton Slivka
Do you have any specific questions, or do you just want us to do your
homework for you?
-Breton.

On 11/1/07, Alexander Uribe [EMAIL PROTECTED] wrote:



 Hi there,

 I have some questions for an assignment that I can't figure out. If anyone
 could be of assistance that would be much appreciated.

 1)Which instruction will change the background colour of an element?
 A   document.getElementById(t).backgroundColor = yellow
 *B*  document.getElementById(t).bgcolor = yellow
 *C*  document.getElementById(t).style.backgroundColor = yellow
 *D*  document.getElementById(t).style.color = yellow

 2)
 Which are the valid 'for' statement(s)
 *A*  for x = 1 to 10
 *B*  for(x=0; x10; x++)
 *C*  for(x=0, y=10; x10; x++, y--)
 *D*  for(x=0, x10, x++)

 3)
 Which are the INCORRECT math equations
 *A*  a =+ 20;
 *B*  a = a + 20;
 *C*  a = 20 / 4;
 *D*  a++;
 *E*  a != 30;
 *F*  a =* 4;
 *G*  a = 3;

 4)
 Which are the preferred methods to use when Javascript has been disabled ?
 *A*  noscript/noscript
 *B*  a href=# onCick=myFunction();Show Page/a
 *C*  a href=page1.htmShow Page/a
 *D*  a href=page1.htm onCick=myFunction();Show Page/a

 5)
 An array can be initialised by
 *A*  var a = new Array(ab,b,c);
 *B*  var a = [a,b,c];
 *C*  var a = (a,b,c);
 *D*  var a = a[a,b,c];

 6)
 When you tab into a form control (i.e. a textbox) what event is executed
 *A*  onMouseOut
 *B*  onClick
 *C*  onBlur
 *D*  onFocus

 7)
 What syntax is needed to initalise a Regular Expression
 *A*  var re = RegExp();
 *B*  var re = new RegExp();
 *C*  var re = regexp;
 *D*  var re = new regexp();

 8)
 What does the following function do
 function x(y){
 document.getElementById(y).style.display;
 a = (z=='block') ? 'none' : 'block';
 z.a;
 }
 *A*  hide or shows a div tag
 *B*  hide or shows an element
 *C*  hide or shows a paragraph
 *D*  hide or show a table

 9)
 Which cross browser (but not W3C DOM compliant instructions) can be used
 to find the Height and Width of an object on a web page *A*  clientWidth,
 clientHeight
 *B*  scrollWidth, scrollHeight
 *C*  scrollTop, scrollLeft
 *D*  offsetWidth, offsetHeight

 10)
 If Javascript has been disabled by the user then
 *A*  inline scripting will still work
 *B*  only mouse events will still work
 *C*  AJAX will still be useable
 *D*  no scripts will be executed


 Cheers.

 --
 Join Lavalife for free. What are you waiting 
 for?http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%26a%3D30288_t=764581033_r=email_taglines_Join_free_OCT07_m=EXT

 ***
 List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
 Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
 Help: [EMAIL PROTECTED]
 ***


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***

Re: [WSG] Javascript Help

2007-10-31 Thread Brian Cummiskey

Alexander Uribe wrote:
If anyone can help with the following questions, that would be greatly 
appreciated

do your own homework.


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



[WSG] Javascript Help

2007-10-31 Thread Alexander Uribe
 
 
 
 
It was just a few questions that i was unsure of.
 
 
Dont bother
 
 
Cheers,
 
 
_
Your Future Starts Here. Dream it? Then be it! Find it at www.seek.com.au
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau%2F%3Ftracking%3Dsk%3Ahet%3Ask%3Anine%3A0%3Ahot%3Atext_t=764565661_r=OCT07_endtext_Future_m=EXT

***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***


RE: [WSG] javascript help

2007-10-31 Thread Frank Palinkas
Alexander,

 

What good will it do you if the correct answers are supplied and you have
absolutely no concept as to why they are correct?

 

Time to do some research, study, and experimentation, like everyone else.

 

Kind regards,

Frank

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Alexander Uribe
Sent: Thursday, 01 November, 2007 6:46 AM
To: wsg@webstandardsgroup.org
Subject: [WSG] javascript help
 
Hi there,
 
I have some questions for an assignment that I can't figure out. If anyone
could be of assistance that would be much appreciated.
 





Join Lavalife for free. What are you waiting for?
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2E
au%2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3De
n%5FAU%26a%3D30288_t=764581033_r=email_taglines_Join_free_OCT07_m=EXT 


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*** 



***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***


Re: [WSG] javascript help

2007-10-31 Thread Christian Snodgrass
I don't like giving out answers to homework questions, but here are some 
hints:
1) Which attribute is used for setting the background (in HTML)? Which 
property is used to set a background color with CSS (which is what style 
uses)?

2) Only one of those is correct. Check online for the  proper syntax.
3) The short operators have the operator then the = sign. Also, ! is a 
conditional operator for not.
4) There is only one of those I would consider using... I don't like 
having to click to see my page.
5) Only one of those is correct. I bet you can figure out which one is 
needed to make a new array.
6) There is only one. onClick and onMouseOut don't sound like something 
a keyboard could do. Use google to figure out what the other two do.
7) Objects always have capital letters, so you should use them when you 
make a new one.
8) I think the second line needs to be z = 
document.getElementById(y).style.display;. === is a comparison operator 
to compare something. The line that starts with a is an alternate form 
of an if statement with the syntax of contition : iftrue ? iffalse

9) Don't have a hint for this one. I recommend google again.
10) It'd be annoying for Javascript to work when it was turned off. .

Hope that helped, without giving it away. ;)

Also, Google is your friend. =)

Alexander Uribe wrote:
 
 
Hi there,
 
I have some questions for an assignment that I can't figure out. If 
anyone could be of assistance that would be much appreciated.
 
1)Which instruction will change the background colour of an element?

A   document.getElementById(t).backgroundColor = yellow
*B*  document.getElementById(t).bgcolor = yellow
*C*  document.getElementById(t).style.backgroundColor = yellow
*D*  document.getElementById(t).style.color = yellow
 
2)

Which are the valid 'for' statement(s)
*A*  for x = 1 to 10
*B*  for(x=0; x10; x++)
*C*  for(x=0, y=10; x10; x++, y--)
*D*  for(x=0, x10, x++)
 
3)

Which are the INCORRECT math equations
*A*  a =+ 20;
*B*  a = a + 20;
*C*  a = 20 / 4;
*D*  a++;
*E*  a != 30;
*F*  a =* 4;
*G*  a = 3;
 
4)

Which are the preferred methods to use when Javascript has been disabled ?
*A*  noscript/noscript
*B*  a href=# onCick=myFunction();Show Page/a
*C*  a href=page1.htmShow Page/a
*D*  a href=page1.htm onCick=myFunction();Show Page/a
 
5)

An array can be initialised by
*A*  var a = new Array(ab,b,c);
*B*  var a = [a,b,c];
*C*  var a = (a,b,c);
*D*  var a = a[a,b,c];
 
6)

When you tab into a form control (i.e. a textbox) what event is executed
*A*  onMouseOut
*B*  onClick
*C*  onBlur
*D*  onFocus
 
7)

What syntax is needed to initalise a Regular Expression
*A*  var re = RegExp();
*B*  var re = new RegExp();
*C*  var re = regexp;
*D*  var re = new regexp();
 
8)

What does the following function do
function x(y){
document.getElementById(y).style.display;
a = (z=='block') ? 'none' : 'block';
z.a;
}
*A*  hide or shows a div tag
*B*  hide or shows an element
*C*  hide or shows a paragraph
*D*  hide or show a table
 
9)
Which cross browser (but not W3C DOM compliant instructions) can be 
used to find the Height and Width of an object on a web page *A*  
clientWidth, clientHeight

*B*  scrollWidth, scrollHeight
*C*  scrollTop, scrollLeft
*D*  offsetWidth, offsetHeight
 
10)

If Javascript has been disabled by the user then
*A*  inline scripting will still work
*B*  only mouse events will still work
*C*  AJAX will still be useable
*D*  no scripts will be executed
 
 
Cheers.



Join Lavalife for free. What are you waiting for? 
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%26a%3D30288_t=764581033_r=email_taglines_Join_free_OCT07_m=EXT

***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*** 



--

Christian Snodgrass
Azure Ronin Web Design
http://www.arwebdesign.net/
Phone: 859.816.7955



***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



[WSG] javascript help

2007-10-31 Thread Alexander Uribe
 
 
 
Thanks for the reply.
 
I took everyones advice and found out the answers myself.
Javascript always seems to be quite daunting for me, but found out that it 
doesn't have to be at all.
 
 
Apologies for the email.
_
Your Future Starts Here. Dream it? Then be it! Find it at www.seek.com.au
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau%2F%3Ftracking%3Dsk%3Ahet%3Ask%3Anine%3A0%3Ahot%3Atext_t=764565661_r=OCT07_endtext_Future_m=EXT

***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***