Jump to content
php.lv forumi

Recommended Posts

Posted

Es izmantoju smarkup text editoru.

Vienam textarea radas smarkup dizains bet otram nerādas kods:

<script type="text/javascript" src="smarkup/smarkup.js"></script>
<script type="text/javascript" src="smarkup/conf/html/conf.js"></script>
<p>Teksts:
<textarea name="zina" id="html">
</textarea>
<p>Teksts:
<textarea name="ievads" id="html"  >
</textarea>

<script type="text/javascript">
SMarkUp.bind(
	'html', //textarea id 
	'html', //makup configuration name 
	300		//height of textarea
);
</script>
<script type="text/javascript">
var remove = document.getElementById('remove');
remove.onclick = function() {
	if (this.rel == 'on') {
		this.innerHTML = 'Return SmartMarkUP Back';
		this.rel = 'off';
		var textarea = SMarkUp.getInstance('html');
		textarea.remove();
	} else {
		this.innerHTML = 'Remove SmartMarkUP';
		this.rel = 'on';
		SMarkUp.bind(
			'html', //textarea id 
			'html', //makup configuration name 
			300		//height of textarea
		);
	}
	return false;
};
</script>

Posted

id atribūtam jābūt unikālam. T.i. dokumentā nedrīkst būt divi html elementi ar vienādām id atribūtu vērtībām.

Taisi dažādas id atribūtu vērtības un izsauc SMarkUp.bind divas reizes katram atsevišķi.

Posted (edited)

Nedrīkst būt elementi ar vienādiem id.

Es meiģināju:

<script type="text/javascript" src="smarkup/smarkup.js"></script>
<script type="text/javascript" src="smarkup/conf/html/conf.js"></script>
<p>Teksts:
<textarea name="zina" id="html">
</textarea>
<p>Teksts:
<textarea name="ievads" id="html1"  >
</textarea>

<script type="text/javascript">
       SMarkUp.bind(
               'html', //textarea id 
               'html', //makup configuration name 
               300             //height of textarea
       );
</script>
<script type="text/javascript">
       var remove = document.getElementById('remove');
       remove.onclick = function() {
               if (this.rel == 'on') {
                       this.innerHTML = 'Return SmartMarkUP Back';
                       this.rel = 'off';
                       var textarea = SMarkUp.getInstance('html');
                       textarea.remove();
               } else {
                       this.innerHTML = 'Remove SmartMarkUP';
                       this.rel = 'on';
                       SMarkUp.bind(
                               'html', //textarea id 
                               'html', //makup configuration name 
                               300             //height of textarea
                       );
               }
               return false;
       };
</script>
<script type="text/javascript">
       SMarkUp.bind(
               'html1', //textarea id 
               'html1', //makup configuration name 
               300             //height of textarea
       );
</script>
<script type="text/javascript">
       var remove = document.getElementById('remove');
       remove.onclick = function() {
               if (this.rel == 'on') {
                       this.innerHTML = 'Return SmartMarkUP Back';
                       this.rel = 'off';
                       var textarea = SMarkUp.getInstance('html1');
                       textarea.remove();
               } else {
                       this.innerHTML = 'Remove SmartMarkUP';
                       this.rel = 'on';
                       SMarkUp.bind(
                               'html1', //textarea id 
                               'html1', //makup configuration name 
                               300             //height of textarea
                       );
               }
               return false;
       };
</script>


Bet tikuntā otram textaream neradas dizains

Edited by zintis8789
Posted

Pieņemu, ka "makup configuration name" arguments nav jāmaina no "html" uz kaut ko citu. Katrā ziņā apskaties dokumentācijā, ko tieši nozīmē pirmais un otrais arguments bind funkcijai.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...