/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Syntax error ,can’t solve……

Hi friends,
I had an element as:

[CODE]
<%
a=0
set get_proj=baglan.execute(“select * from projeler”)
while not get_proj.eof
a=a+1
%>
<div class=”<%=get_proj(“pcat”)%>kutu”>
<div id=”<%=get_proj(“pcode”)%>” > <a href=”<%=get_proj(“plink”)%>” onclick=”sara_f<%=get_proj(“pshort_name”)%>();return false;”><img src=”png_thumb/<%=get_proj(“pmin_img”)%>” class=”kutu” /></a> </div>
</div>
<%
get_proj.movenext
wend
get_proj.close
set get_proj=nothing
%>
[/CODE]

and function for it:

[CODE]
<%
set get_proj3=baglan.execute(“select * from projeler”)
while not get_proj3.eof
%>
//this function opens the window I’ve reated
function sara_f<%=get_proj3(“pshort_name”)%>(){
$(‘bahr_kutu’).morph(‘ height:690px;width:1260px;’);
$(‘bahr_kutu’).insert(‘<div id=”bahr_frameicerik”></div>’);
$(‘bahr_projeadi’).replace(‘<div id=”bahr_projeadi”><%=get_proj3(“pfull_name”)%></div>’);
$(‘bahr_projeyilyer’).replace(‘<div id=”bahr_projeyilyer”><%=get_proj3(“pwhere”)%>-<%=get_proj3(“pyear”)%></div>’);
setTimeout(function(){$(‘bahr_frameicerik’).insert(‘<iframe name=”bahr_frame” src=”<%=get_proj3(“plink”)%>” allowtransparency=”true” width=”100%” height=”100%” scrolling=”no” frameborder=”0″ /> ‘);},1000);
}

<%
get_proj3.movenext
wend
get_proj3.close
set get_proj3=nothing
%>

[/CODE]

This worked fine!,but
as you see I created a endless function for endless elements,that causes page shrink. As I am started to learn javascript and asp for new, a few days ago I attempted to learn how to create global functions:
So I tried to create this:

[CODE]
function [COLOR=”Blue”]kutular_fonk[/COLOR]( [COLOR=”Red”]pfullname, plink, pwhere, pyear[/COLOR] ){

$(‘bahr_kutuoverlay’).setStyle({‘display’:’block’});
$(‘bahr_kutu’).morph(‘height:690px;width:1260px’);
$(‘bahr_kutu’).insert(‘<div id=”bahr_frameicerik”></div>’);
$(‘bahr_projeadi’).replace(‘<div id=”bahr_projeadi”> [COLOR=”Red”]pfullname[/COLOR] </div>’);
$(‘bahr_projeyilyer’).replace(‘<div id=”bahr_projeyilyer”> [COLOR=”Red”]pwhere – pyear[/COLOR] </div>’);
setTimeout(function(){$(‘bahr_frameicerik’).insert(‘<iframe name=”bahr_frame” src=[COLOR=”Red”]plink[/COLOR] allowtransparency=”true” width=”100%” height=”100%” scrolling=”no” frameborder=”0″ /> ‘);},1000);
}
[/CODE]

function is not looping any more.
I edited element for it as:

[CODE]
<%
a=0
set get_proj=baglan.execute(“select * from projeler”)
while not get_proj.eof
a=a+1
%>
<div class=”<%=get_proj(“pcat”)%>kutu”>
<div id=”<%=get_proj(“pcode”)%>”><a href=”#” onclick=”[COLOR=”Blue”]kutular_fonk[/COLOR](“<%=get_proj(“pfull_name”)%>”,”<%=get_proj(“plink”)%>”,”<%=get_proj(“pwhere”)%>”); return false;”> <img src=”png_thumb/<%=get_proj(“pmin_img”)%>” class=”kutu” /></a> </div>
</div>
<%
get_proj.movenext
wend
get_proj.close
set get_proj=nothing
%>

[/CODE]

the result gives:

[CODE]
<div class=”yonetimkutu”>
<div id=”yonk_korfezticaret”><a href=”#” onclick=”kutular_fonk(“Körfez Ticaret Odas&#305;”,”http://www.mypage.com/dene640.jpg”,”Kocaeli”); return false;”> <img src=”png_thumb/3_thumb.png” class=”kutu” /></a> </div>
</div>

[/CODE]

But it causes syntax error at kutular_fonk.

please help.

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@mimartjauthorFeb 28.2009 — I think that :

"Körfez Ticaret Odas&#305;"

in:

<div id="yonk_korfezticaret"><a href="#" onclick="kutular_fonk([COLOR="blue"]"Körfez Ticaret Odas&#305;"[/COLOR],"http://www.mypage.com/dene640.jpg","Kocaeli"); return false;"> <img src="png_thumb/3_thumb.png" class="kutu" /></a> </div>

can't be equal as:

function kutular_fonk( [COLOR="Blue"]pfullname[/COLOR], plink, pwhere, pyear )

No idea yet?
Copy linkTweet thisAlerts:
@mimartjauthorFeb 28.2009 — when I changed " " to ' ' it didn't give me any error, it opened my window but the variables that I give didn't work :

ex.

[COLOR="Red"]'<%=get_proj("pfull_name")%>'[/COLOR] is rendered as [COLOR="Red"]'Körfez Ticaret Odas&#305;'[/COLOR]

but kutular_fonk function doesn't recognize it as 'Körfez Ticaret Odas' it still writes it as [COLOR="Red"]'pfull_name'[/COLOR]. The prtoblem is in my function:
Copy linkTweet thisAlerts:
@mimartjauthorFeb 28.2009 — when I changed " " to ' ' it didn't give me any error, it opened my window but the variables that I give didn't work :

ex.

[COLOR="Red"]'<%=get_proj("pfull_name")%>'[/COLOR] is rendered as [COLOR="Red"]'Körfez Ticaret Odas&#305;'[/COLOR]

but kutular_fonk function doesn't recognize it as 'Körfez Ticaret Odas' it still writes it as [COLOR="Red"]'pfull_name'[/COLOR]. The prtoblem is in my function:
Copy linkTweet thisAlerts:
@FangFeb 28.2009 — Syntax errors are difficult to find without seeing the generated code or a link.
As I am started to learn javascript ..
[/QUOTE]
This is Prototype not JavaScript.
Copy linkTweet thisAlerts:
@mimartjauthorFeb 28.2009 — Hi Fang, you helped me before, please help this time

I started with prototype because native javascript wast a little complex .Prototype is simple compressed functions and methods.

this is div:

[CODE]<div class="yonetimkutu">
<div class="yonetimkutu">
<div id="yonk_korfezticaret"><a href="http://www.mypage" onclick="kutular_fonk('K&#246;rfez Ticaret Odas&#305;','http://www.mypage', 'Kocaeli', '2007'); return false;"><img src="png_thumb/3_thumb.png" class="kutu" /></a> </div>
</div>
[/CODE]

this is function:

[CODE]
function kutular_fonk( pfullname, plink, pwhere, pyear){
$('bahr_kutuoverlay').setStyle({'display':'block'});
$('bahr_kutu').morph('height:690px;width:1260px');
$('bahr_kutu').insert('<div id="bahr_frameicerik"></div>');
$('bahr_projeadi').replace('<div id="bahr_projeadi"> pfullname </div>'); [COLOR="Blue"]// here pfullname [/COLOR]
$('bahr_projeyilyer').replace('<div id="bahr_projeyilyer">pwhere - pyear</div>'); [COLOR="Blue"]//here pwhere and pyear[/COLOR]
setTimeout(function(){$('bahr_frameicerik').insert('<iframe name="bahr_frame" src=plink allowtransparency="true" width="100&#37;" height="100%" scrolling="no" frameborder="0" /> ');},1000);
} [COLOR="Blue"]// here plink[/COLOR]
[/CODE]

just cant get data ( pfullname, plink, pwhere, pyear) written id <div>'s a tag to get the funciton work.
Copy linkTweet thisAlerts:
@FangFeb 28.2009 — $('bahr_projeadi').replace('&lt;div id="bahr_projeadi"&gt;[COLOR="Blue"]'+[/COLOR]pfullname[COLOR="Blue"]+'[/COLOR]&lt;/div&gt;');
Copy linkTweet thisAlerts:
@mimartjauthorFeb 28.2009 — Thanks you very much Fang,

I knew that it must be so easy, just I didn't learn it yet.

It worked without any problem.

Do you know where to fine some tutorial to understand what [COLOR="Red"] '+....+'[/COLOR] is it exactly.

And can you give some tips about my next simple question.

<div class="yonetimkutu">
[CODE]<div id="yonk_korfezticaret"><a [COLOR="red"]href="#"[/COLOR] onclick="kutular_fonk("Körfez Ticaret Odas&#305;",[COLOR="RoyalBlue"]"http://www.mypage.com/dene640.jpg"[/COLOR],"Kocaeli"); return false;"> <img src="png_thumb/3_thumb.png" class="kutu" /></a> </div>
</div>[/CODE]

in [COLOR="red"]href="#"[/COLOR] I want to write a link, and in :
[CODE]('<iframe name="bahr_frame" [COLOR="Red"]src=plink [/COLOR]allowtransparency="true" width="100%" height="100%" scrolling="no" frameborder="0" /> ');},1000);[/CODE]

make [COLOR="Red"]plink[/COLOR] to clone that href?So I will not write any link in my kutular_fonk() function

thanks from now
Copy linkTweet thisAlerts:
@FangFeb 28.2009 — This is basic JavaScript, this is why it's important to learn JavaScript before using a framework.

concatenate: http://www.quirksmode.org/js/strings.html#conc
&lt;div id="yonk_korfezticaret"&gt;&lt;a href="http://www.mypage.com/dene640.jpg" onclick="kutular_fonk("K&amp;#246;rfez Ticaret Odas&amp;#305;", this.href, "Kocaeli"); return false;"&gt; &lt;img src="png_thumb/3_thumb.png" class="kutu" /&gt;&lt;/a&gt; &lt;/div&gt;
&lt;/div&gt;

('&lt;iframe name="bahr_frame" src="'+plink+'" allowtransparency="true" width="100&amp;#37;" height="100%" scrolling="no" frameborder="0" /&gt; ');},1000);
Copy linkTweet thisAlerts:
@mimartjauthorFeb 28.2009 — Thanks again....
×

Success!

Help @mimartj spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...