הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   2 שאלות בASP (https://hosts.co.il/forums/showthread.php?t=21731)

adiga000 13-05-06 09:24

2 שאלות בASP
 
1 - האם יש משתנים בASP??
כי לא מצאתי ..
אם יש תסבירו לי איך עובדים עם זה.


2 - עורך טקסט בASP
איך עושים שזה יערוך את הטקסט??
כאילו בPHP זה כל..
עושים ככה
$text = [B]blabal[-B] blabla
$text = preg_replace("/[B]/","<strong>",$text)
$text = preg_replace("/[-B]/","</strong>",$text)
echo $text;

ציטוט:

גם אם מה שעשיתי למעלה לא נכון זה רק להשדגמא כמה זה קל
עכשיו אני רוצה לעשות עורך טקסט בASP

...
ואני לא מבין איך.

-VladK- 13-05-06 09:30

עורך טקסט לא בהכרח עושים (אם בכלל) בASP...אני יודע שעושים את זה בJS...

BlueNosE 13-05-06 09:33

ברור שיש, אנלא יודע ASP אבל בVB זה נדמה לי
Dim Blabla;
ובJS
Var Blabla;

אני לא בטוח תבדוק

adiga000 13-05-06 10:27

תכתבו תשובה מנוסחת..
לא הבנתי מכם כלום..

תכתבו לפי הסעיפים 1 ו2..

ויש עורך טקסט פעם מצאתי בASP
אבל נאבד לי

eLad 13-05-06 10:31

ASP + JS

הגדרת משתנה כך:
קוד:

var sSomeString;
הכנסת תוכן למשתנה עם הגדרותו:
קוד:

var sSomeString="blabla";
ביצוע החלפה של האות a באות b (תוצאה ראשונה בלבד)
קוד:

tmp=tmp.replace("a","b");
ביצוע החלפה של כל התוצאות בטקסט מסויים של האות a לאות b:
קוד:

tmp=tmp.replace(/"a"/g,"b");

adiga000 13-05-06 10:55

יש שגיאות .... מה הבעיה פה?
ציטוט:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<a href="#" onclick ="(document.getElementById('msg').value=document.g etElementById('msg').value + '[B][-B]')"><img src="images/bold.gif" border="0" alt="טקסט בולט"></a>
<a href="#" onclick ="(document.getElementById('msg').value=document.g etElementById('msg').value + '[I][-I]')"><img src="images/italian.gif" border="0" alt="טקסט אלכסוני"></a>
<a href="#" onclick ="(document.getElementById('msg').value=document.g etElementById('msg').value + '[U][-U]')"><img src="images/underline.gif" border="0" alt="קו תחתון"></a>
<a href="#" onclick ="(document.getElementById('msg').value=document.g etElementById('msg').value + '[IMG][-IMG]')"><img src="images/img.gif" border="0" alt="הוסף תמונה"></a>
<a href="#" onclick ="(document.getElementById('msg').value=document.g etElementById('msg').value + '[C][-C]')"><img src="images/center.gif" border="0" alt="טקסט באמצע"></a>
<br />
<Form action="n_news.asp" method="post">
<textarea cols="50" rows="10" id="msg"></textarea>
<input type="submit" />
</Form>
<Br />
<br />
<Br />
<%

var text="" & Request.Form("msg") & ""
text=text.replace(/"[B]"/g,"<strong>");
text=tmp.replace(/"[-B]"/g,"</strong>");
text=tmp.replace(/"[I]"/g,"<em>");
text=tmp.replace(/"[-I]"/g,"</em>");
text=tmp.replace(/"[U]"/g,"b");
text=tmp.replace(/"[-U]"/g,"b");
text=tmp.replace(/"[C]"/g,"<center>");
text=tmp.replace(/"[-C]"/g,"</center>");
text=tmp.replace(/"[IMG]"/g,"<img src='");
text=tmp.replace(/"[-IMG]"/g,"' border='0'>");
%>
<%=text %>
</body>
</html>

eLad 13-05-06 11:02

ברור שיהיו שגיאות, אתה מגדיר את שפת הדף ב VBs וכותב בפנים JS? מה ההיגיון?

ופעם הבאה צרף גם את השגיאה שמתקבלת

נ.ב.
לא, אין לי מסנג'ר

eLad 13-05-06 11:24

אתה כותב את הדף עצמו ב JS ומשתמש בתחביר של VBs?
ב JS אין שרשור מחרוזות עם & וכדי לקבל את הערך ה QueryString אתה צריך להוסיף () בסוף

ועבור כל החלפה תעשה משהו כזה:
ציטוט:

text=tmp.replace(/[-B]/g,"<\/strong>");
סורי על הדאבל פוסט .. הבחור שואל אותי במסרים

adiga000 13-05-06 15:31

אני אנסה ותודה לך!

adiga000 13-05-06 15:42

עדיין יש את אותה השגיאה באותו השורה


כל הזמנים הם GMT +2. הזמן כעת הוא 19:10.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ